package com.lubase.metadata.mapper;

import com.lubase.orm.model.auto.DmDatabaseEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * 多数据库测试mapper
 */
@Mapper
public interface MetaDatasourceMapper {
    /**
     * 主框架模式运行下需要获取所有的数据库连接信息
     *
     * @return
     */
    @Select("SELECT a.id,a.database_type,b.host,b.port,b.instance_name,b.user_name,b.password,b.database_code AS database_name  FROM  ms_database a LEFT OUTER JOIN ms_database_info b ON a.id=b.ms_database_id AND b.env_info=#{env} where a.id=#{id}")
    List<DmDatabaseEntity> getAllDatabaseSetting(@Param("id") String id, @Param("env") String env);
}
